<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="sealte.mynode.pojo.User" %>
<%@ page import="sealte.mynode.pojo.Essay" %>
<%@ page import="sealte.mynode.bean.EssayBean" %>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>MyNode</title>
<link rel="stylesheet" type="text/css" href="css/div2.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/index_jsp.js"></script>
</head>
<body>
<%
	User user = (User)session.getAttribute("user");
	int user_id = user.getId();
	String user_name = user.getName();
	String user_email = user.getEmail();
	EssayBean eb = new EssayBean();
	List<Essay> all = eb.listAllExceptThis(user_id);
 %>
<center>
<h1><%=user_name.toUpperCase()%>'s MyNode</h1><br/>
Email:<%=user_email%> #--# <a href="UserLogout?id=<%=user_id%>">Logout</a>
#--# <a href="home.jsp">Back</a>
<div>
<table>
	<tr align="center">
	<td>ID</td><td>AUTHOR</td><td>TITLE</td><td>WRITE-TIME</td><td>MODIFY-TIME</td>
	</tr>
	<%
		if(null!=all && !all.isEmpty()){
			Iterator<Essay> iter = all.iterator();
			while(iter.hasNext()){
				Essay essay = iter.next();
				out.println("<tr><td align=center>"+essay.getId()+"</td><td align=center>"+essay.getAuthor()
				+"</td><td align=center><a href=\"essay.jsp?id="+essay.getId()+"\">"+essay.getTitle()
				+"</a></td><td align=center>"+essay.getWriteTime()+"</td><td align=center>"
				+essay.getModifyTime()+"</td></tr>");
			}
		}else{
	 %>
	 <tr><td colspan="5" align="center">There is nothing!</td></tr>
	 <%
	 	}
	  %>
</table>
</div>
<div>
		<table>
		<tr><th colspan="2" align="center">Current Server</th></tr>
		<tr><td align="right">Session:</td><td align="left"><%=session.getId()%></td></tr> 
		<tr><td align="right">IP:</td><td align="left"><%=java.net.InetAddress.getLocalHost()%></td></tr>
		<tr><td align="right">TempDir:</td><td align="left"><%=System.getProperty("java.io.tmpdir")%></td></tr>
		</table>
	</div>
</center>
</body>
</html>